import 'package:casdon/modules/login/domain/validators/input_validator.dart';

class PasswordValidator implements InputValidator {
  @override
  bool isValude(String input) {
    final passwordRegex = RegExp(r'^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,20}$');
    return passwordRegex.hasMatch(input);
  }

  @override
  String? validateWithMessage(String input) {
    return isValude(input) ? null : '8-20个字符，包含字母和数字';
  }
}
